﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using RoadTeam.Model;
using RoadTeam.Enums;

public partial class 增删改测试_InsertTable : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void 插入Datatable_Click(object sender, EventArgs e)
    {
      DataTable dt=CreateDataTable();
      TbEvlutionText.InsertDatatable(dt, GlobalConfig.ConnectionString);
      SqlWhere where = new SqlWhere();
      GridView1.DataSource = TbEvlutionText.Select(where, GlobalConfig.ConnectionString);
      GridView1.DataBind();

    }

    private DataTable CreateDataTable()
    {
        TbEvlutionText model = new TbEvlutionText();
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("UniqueIdentifier",typeof(string)));
        dt.Columns.Add(new DataColumn("Name", typeof(string)));
        dt.Columns.Add(new DataColumn("Code", typeof(string)));
        dt.Columns.Add(new DataColumn("CreateDate", typeof(DateTime)));
        dt.Columns.Add(new DataColumn("Remark", typeof(string)));
        DataRow dr;
        for (int i = 0; i < 50; i++)
        {
            dr = dt.NewRow();
            dr["UniqueIdentifier"] = Guid.NewGuid().ToString("N");
            dr["Name"] = @"测试数据" + i.ToString();
            dr["Code"] = @"测试数据" + i.ToString();
            dr["CreateDate"] = DateTime.Now;
            dr["Remark"] = @"测试数据测试数据测试数据测试数据测试数据" + i.ToString();
            dt.Rows.Add(dr);
        }
        return dt;
    }
}